import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

// 路由字典，定义路径与vue组件的对应关系
const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/index',
    name: 'Index',
    component: () => import('../views/Index.vue')
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  },{
    path:'/directive',
    name:'Directive',
    component:()=>import('../views/Directive.vue')
  },{
    path:'/for',
    name:'For',
    component:()=>import('../views/For.vue')
  },{
    path:'/cart',
    name:'Cart',
    component:()=>import('../views/Cart.vue')
  },{
    path:'/register',
    name:'Register',
    component:()=>import('../views/Register.vue')
  }
  ,{
    path:'/axios',
    name:'Axios',
    component:()=>import('../views/Axios.vue')
  }  ,{
    path:'/actors',
    name:'Actors',
    component:()=>import('../views/Actors.vue')
  },{
    path:'/detail',
    name:'Detail',
    component:()=>import('../views/Detail.vue')
  },{
    path:'/detail/:id',
    name:'Detail2',
    component:()=>import('../views/Detail.vue')
  }


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
